using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class VBillOMPriceMap : EntityTypeConfiguration<VBillOMPrice>
    {
        public VBillOMPriceMap()
        {
            // Primary Key
            this.HasKey(t => new { t.assembly, t.ITEM, t.Name, t.PLid, t.currency });

            // Properties
            this.Property(t => t.assembly)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.ITEM)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.Name)
                .IsRequired()
                .HasMaxLength(250);

            this.Property(t => t.PLid)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.currency)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            // Table & Column Mappings
            this.ToTable("VBillOMPrice");
            this.Property(t => t.assembly).HasColumnName("assembly");
            this.Property(t => t.ITEM).HasColumnName("ITEM");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.CRITERIA).HasColumnName("CRITERIA");
            this.Property(t => t.PLid).HasColumnName("PLid");
            this.Property(t => t.currency).HasColumnName("currency");
            this.Property(t => t.HospitalPrice).HasColumnName("HospitalPrice");
            this.Property(t => t.sergeonPrice).HasColumnName("sergeonPrice");
            this.Property(t => t.AnastesiaPrice).HasColumnName("AnastesiaPrice");
        }
    }
}
